#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <sys/wait.h>

int main(int argc, char* argv[])
{
  struct timespec start, end;
  setpgrp();
  clock_gettime(CLOCK_MONOTONIC, &start);
  if (fork() == 0) {
    execv(argv[1], argv + 1);
    return 1;
  }
  wait(NULL);
  clock_gettime(CLOCK_MONOTONIC, &end);
  end.tv_sec -= start.tv_sec;
  end.tv_nsec -= start.tv_nsec;
  if (end.tv_nsec < 0) {
    --end.tv_sec;
    end.tv_nsec += 1000000000;
  }
  fprintf(stderr, "%ldm %ld.%03lds\n",
      (long)end.tv_sec / 60, (long)end.tv_sec % 60, (long)end.tv_nsec / 1000000);
  return 0;
}
